package cn.cxq.learning.e2_2and3;

/**
 * 逐项求和法
 */
public class TermByTermSummation {

    public static double polyValue(double x, double[] A, int N) {
        int k;
        double power = 1.0, y = 0.0;
        y = A[0];
        for (k = 1; k <= N; k++) {
            power *= x;
            y += A[k] * power;
        }
        return y;
    }
}
